class Weapon(object):
    numbers = 0 # 类属性
    max_damage = 10000 # 类属性
    level = ["钻石","星耀","王者","荣耀"] # 类属性
    all_weapons = []
    def __init__(self,name,damage,level):
        self.name = name
        self.damage = damage
        self.level = level
        Weapon.numbers += 1
        if damage > Weapon.max_damage:
            raise Exception("最大的伤害值是10000，请重试")
        if level not in Weapon.level:
            raise Exception("段位设置错误")

        Weapon.all_weapons.append(self)

    @classmethod # 类方法
    def get_max_damage(cls):
         max_damage = 0
         for w in cls.all_weapons:
             if w.damage > max_damage:
                 max_damage = w.damage
         return max_damage

    @staticmethod # 静态方法
    def isvalid(**kwargs):
        if kwargs['age'] > 18:
            return True
        else:
            return False

infos = {'name':'jay','age':17,'city':'北京','level':'白银'}
if Weapon.isvalid(**infos):
   gun = Weapon('magic',2000,"王者")
   print(gun.__dict__)
else:
    print("请检查！")